#include<bits/stdc++.h>
#define int long long
using namespace std;

signed  main() {
	int t, ret = 0;
	cin >> t;
	for(int i = 1; i <= t; ++i) {
		int x;
		cin >> x;
	    ret = (ret + x * (t - 1)) % 2;
	}
	cout << ret % 2 << endl;
	return 0;
}
